class Solution {
public:
    vector<vector<int>> rst;

    vector<vector<int>> combine(int n, int k) {
        combineStep(1, n, k, {});
        return rst;
    }

    void combineStep(int form, int to, int num, vector<int> combine){
        if(num == 0) {
            rst.push_back(combine);
            return;
        };

        for(int i = form; i <= to - num + 1; ++i) {
            combine.push_back(i);
            combineStep(i + 1, to, num - 1, combine);
            combine.pop_back();
        }
    }
};